package com.cyj.dream.upms.model.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.cyj.dream.core.base.SysBaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.List;

/**
 * @Description: 部门信息表
 * @BelongsProject: dream-DreamChardonnay
 * @BelongsPackage: com.dream.DreamChardonnay.model.system
 * @Author: ChenYongJia
 * @CreateTime: 2021-05-08 14:09
 * @Email: chen87647213@163.com
 * @Version: 1.0
 */
@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "dream_sys_department")
@TableName("dream_sys_department")
@ApiModel(value = "部门信息表", description = "dream_sys_department 部门信息表")
public class SysDepartment extends SysBaseEntity implements Serializable {

    @ApiModelProperty(value = "部门名称")
    @Column(columnDefinition = "varchar(128) COMMENT '部门名称'")
    private String sysDepartmentName;

    @ApiModelProperty(value = "部门组")
    @Column(columnDefinition = "varchar(255) COMMENT '部门组'")
    private String sysDepartmentGroup;

    @ApiModelProperty(value = "部门负责人")
    @Column(columnDefinition = "varchar(64) COMMENT '部门负责人'")
    private String sysDepartmentPrincipal;

    @ApiModelProperty(value = "部门负责人联系方式")
    @Column(columnDefinition = "varchar(11) COMMENT '部门负责人联系方式'")
    private String sysDepartmentPrincipalPhone;

    @ApiModelProperty(value = "部门负责人邮箱")
    @Column(columnDefinition = "varchar(100) COMMENT '部门负责人邮箱'")
    private String sysDepartmentPrincipalEmail;

    @ApiModelProperty(value = "父节点id", example = "1")
    @Column(columnDefinition = "bigint(20) COMMENT '父节点id'")
    private Long sysDepartmentParentId;

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "部门名称")
    private String sysDepartmentIndex = this.sysDepartmentName;

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "是否选中")
    private boolean checked;

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "辅助设置部门Id", example = "1")
    private Integer sysDepartmentIds;

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "辅助设置部门名称")
    private String sysDepartmentNames;

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "子节点数据集合")
    private List<SysDepartment> children;

    @Transient
    @TableField(exist = false)
    @ApiModelProperty(value = "判断是否为子节点")
    private Boolean isChildren = false;

    @Override
    public String toString() {
        return "SysDepartment{" +
                ", sysDepartmentName='" + sysDepartmentName + '\'' +
                ", sysDepartmentGroup='" + sysDepartmentGroup + '\'' +
                ", sysDepartmentPrincipal='" + sysDepartmentPrincipal + '\'' +
                ", sysDepartmentPrincipalPhone='" + sysDepartmentPrincipalPhone + '\'' +
                ", sysDepartmentPrincipalEmail='" + sysDepartmentPrincipalEmail + '\'' +
                ", sysDepartmentParentId=" + sysDepartmentParentId +
                '}';
    }

}
